package minOperations;

public class Solution {
    public int minOperations(int[] nums) {

        // ai = a1+i
        int ans = 0;
        for (int i = 1; i < nums.length; i++) {
            if(nums[i]<=nums[i-1]){
                int t = nums[i-1]+1 - nums[i];
                ans+=t;
                nums[i] = nums[i-1]+1;
            }
        }
        return ans;
    }
}
